<template>
	<view>
		<!-- 导航栏 -->
		<navigation  title="修改密码"></navigation>
	    <view class="onlie"></view>
		<view class="list">		
		    <text class="text">原密码</text>
			<input type="password"  v-model="password" />
		    <uni-icons class="icon"  type="clear" size="20" color="#cccccc"></uni-icons>	
		</view>
		<view class="list">
		    <text class="text">新密码</text>
			<input type="password" v-model="newpassword"/>
		    <uni-icons class="icon"  type="clear" size="20" color="#cccccc"></uni-icons>	
		</view>
		
		
		<button  class="btn" @click="editPwd">保存</button>
	</view>
</template>

<script>
	import navigation from '@/component/navigation.vue'
	import sun from '@/utils/sun.js'
	export default {
		components:{
			navigation
		},
		data() {
			return {
				password:'',
				newpassword:'',
			};
		},
		created() {
		},
		methods:{
			editPwd(){
				let that=this;
				sun.request({
						url: "/h5/ucenter.Usercenter/doRepassword",
						showLoading: true,
						token:true,
						data:{
							id:uni.getStorageSync('user').id,
							password:that.password,
							newpassword:that.newpassword
						},
						success(res) {				
							if(res.code==200){
								uni.showToast({
									icon: "none",
									title: res.msg,
								})
								uni.redirectTo({
									url:'/pages/login/login'
								})
								uni.clearStorage()
							}
						},
						fail(e) {
							uni.showToast({
								icon: "none",
								title: "服务器开小差去啦~",
							})
						}
				})
			}
		}
	}
</script>

<style lang="less">
.onlie{
	width:750upx;
	height:16upx;
	background:rgba(245,246,246,1);
}
.btn{
	position: fixed;
	left: 50%;
	bottom: 73upx;
	margin-left: -343upx;
	width:686upx;
	height:73upx;
	background:rgba(64,108,235,1);
	border-radius:36upx;
	line-height: 73upx;
	font-size:28upx;
	font-family:PingFang SC;
	font-weight:500;
	color:rgba(255,255,255,1);
}

.list{
	position: relative;
	width:718upx;
	padding: 32upx 0;
	margin-left: 32upx;
    overflow: hidden;
	display: flex;
	justify-content: left;
	.text{
		font-size:28upx;
		font-family:PingFang SC;
		font-weight:500;
		color:rgba(25,25,25,1);
	}
	input{
		width:580upx;
		margin-left: 10upx;
		padding-left: 20upx;
		padding-bottom: 20upx;
		font-size:28upx;
		font-family:PingFang SC;
		font-weight:500;
		color:rgba(25,25,25,1);
		border-bottom:1upx solid rgba(226,226,226,1) ;
	}
	.icon{
		position: absolute;
		right: 31upx;
		top: 32upx;
	}
}
</style>
